import java.io.BufferedReader;
//import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
//import java.io.OutputStreamWriter;


public class Main {

	public static void main(String[] args) {

		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		Calculator c = new Calculator();

		try {
			String str = bf.readLine();

			while(!str.equals("END")){
				c.calculate(c.resolve(str));
				str = bf.readLine();
			}
		} catch (IOException e) {
			System.out.println("We we're unable to read the input, please try again.");
		}
	}

}
